<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>xadcps: xadcps_intr_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">xadcps
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xadcps__intr__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xadcps_intr_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the driver functions of the XADC/ADC driver. </p>
<p>This example here shows the usage of the driver/device in interrupt mode to handle on-chip temperature and voltage alarm interrupts.</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This code assumes that no Operating System is being used.</p>
<p>The values of the on-chip temperature and the on-chip Vccaux voltage are read from the device and then the alarm thresholds are set in such a manner that the alarms occur.</p>
<pre></pre><pre>MODIFICATION HISTORY:</pre><pre>Ver   Who    Date     Changes
<hr/>

1.00a bss    01/20/12 First release
2.2   ms     01/23/17 Modified xil_printf statement in main function to
                      ensure that "Successfully ran" and "Failed" strings
                      are available in all examples. This is a fix for
                      CR-965028.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a1c6d46393cad7397e19d5978f448d60c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xadcps__intr__example_8c.html#a1c6d46393cad7397e19d5978f448d60c">XAdcIntrExample</a> (XScuGic *IntcInstancePtr, <a class="el" href="struct_x_adc_ps.html">XAdcPs</a> *XAdcInstPtr, u16 XAdcDeviceId, u16 XAdcIntrId, int *Temp)</td></tr>
<tr class="memdesc:a1c6d46393cad7397e19d5978f448d60c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function runs a test on the XADC/ADC device using the driver APIs.  <a href="#a1c6d46393cad7397e19d5978f448d60c">More...</a><br /></td></tr>
<tr class="separator:a1c6d46393cad7397e19d5978f448d60c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xadcps__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function that invokes the XADC Interrupt example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function that invokes the XADC Interrupt example. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if the example has completed successfully.</li>
<li>XST_FAILURE if the example has failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">References <a class="el" href="xadcps__intr__example_8c.html#a1c6d46393cad7397e19d5978f448d60c">XAdcIntrExample()</a>.</p>

</div>
</div>
<a id="a1c6d46393cad7397e19d5978f448d60c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c6d46393cad7397e19d5978f448d60c">&#9670;&nbsp;</a></span>XAdcIntrExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XAdcIntrExample </td>
          <td>(</td>
          <td class="paramtype">XScuGic *&#160;</td>
          <td class="paramname"><em>IntcInstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_x_adc_ps.html">XAdcPs</a> *&#160;</td>
          <td class="paramname"><em>XAdcInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>XAdcDeviceId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>XAdcIntrId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>Temp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function runs a test on the XADC/ADC device using the driver APIs. </p>
<p>The function does the following tasks:</p><ul>
<li>Initiate the XADC/ADC device driver instance</li>
<li>Run self-test on the device</li>
<li>Reset the device</li>
<li>Set up alarms for on-chip temperature and VCCPAUX</li>
<li>Set up sequence registers to continuously monitor on-chip temperature and VCCPAUX</li>
<li>Setup interrupt system</li>
<li>Enable interrupts</li>
<li>Set up configuration registers to start the sequence</li>
<li>Wait until temperature alarm interrupt or VCCPAUX alarm interrupt occurs</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstancePtr</td><td>is a pointer to the Interrupt Controller driver Instance. </td></tr>
    <tr><td class="paramname">XAdcInstPtr</td><td>is a pointer to the <a class="el" href="struct_x_adc_ps.html" title="The driver&#39;s instance data. ">XAdcPs</a> driver Instance. </td></tr>
    <tr><td class="paramname">XAdcDeviceId</td><td>is the XPAR_&lt;SYSMON_ADC_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">XAdcIntrId</td><td>is XPAR_&lt;INTC_instance&gt;_&lt;SYSMON_ADC_instance&gt;_VEC_ID value from xparameters.h </td></tr>
    <tr><td class="paramname">Temp</td><td>is an output parameter, it is a pointer through which the current temperature value is returned to the main function.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if the example has completed successfully.</li>
<li>XST_FAILURE if the example has failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function may never return if no interrupt occurs. </dd></dl>

<p class="reference">References <a class="el" href="struct_x_adc_ps___config.html#a972132ac319cf4b4ba44c471e6764c32">XAdcPs_Config::BaseAddress</a>, <a class="el" href="group__xadcps__v2__2.html#ga365097ee163084219b30593e3fc886dc">XADCPS_ATR_TEMP_LOWER</a>, <a class="el" href="group__xadcps__v2__2.html#gabb9936055691b405167548fc61cab567">XADCPS_ATR_TEMP_UPPER</a>, <a class="el" href="group__xadcps__v2__2.html#ga7adfae31cec49001437bd7eaaa90ee20">XADCPS_ATR_VCCPAUX_LOWER</a>, <a class="el" href="group__xadcps__v2__2.html#ga16ba2a7160b86fb6bc5037e85edc52d0">XADCPS_ATR_VCCPAUX_UPPER</a>, <a class="el" href="group__xadcps__v2__2.html#ga57807452402a6b52dd48083f676bd4ff">XAdcPs_CfgInitialize()</a>, <a class="el" href="group__xadcps__v2__2.html#gadea5053b3abf2d83b93ed125ff5e2255">XADCPS_CH_TEMP</a>, <a class="el" href="group__xadcps__v2__2.html#gaf8512c31afc362730ef6efbded2015d3">XADCPS_CH_VCCPAUX</a>, <a class="el" href="group__xadcps__v2__2.html#ga249774f7bd8cf631b066db344e77807a">XAdcPs_GetAdcData()</a>, <a class="el" href="group__xadcps__v2__2.html#gadf27053ce16b799289b609bce586aa21">XAdcPs_LookupConfig()</a>, <a class="el" href="group__xadcps__v2__2.html#ga56acf22b23c7ff0ea8ba0c763209d0a6">XAdcPs_SelfTest()</a>, <a class="el" href="group__xadcps__v2__2.html#ga799c7fbcb2e7fd3f27b780f56d764844">XADCPS_SEQ_MODE_SAFE</a>, <a class="el" href="group__xadcps__v2__2.html#ga62adf11abdc10aa3d1f064265337a3dd">XAdcPs_SetAlarmEnables()</a>, <a class="el" href="group__xadcps__v2__2.html#ga222a97998083c80b4f0415a94aa4efc9">XAdcPs_SetAlarmThreshold()</a>, and <a class="el" href="group__xadcps__v2__2.html#gaf004d6f72df7692239604326bb2de23d">XAdcPs_SetSequencerMode()</a>.</p>

<p class="reference">Referenced by <a class="el" href="xadcps__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
